package com.tom.service.impl;

import com.tom.mapper.UserMapper;
import com.tom.pojo.User;
import com.tom.service.IMainService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service("mainService")
public class MainServiceImpl implements IMainService {
    @Resource
    private UserMapper userMapper;

    @Override
    public User getUserById(int userId) {
        return this.userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public User login(User user) {
//        System.out.println("mainservice: " + user);
        return this.userMapper.selectByLogin(user);
    }

    @Override
    public int register(User user) {
        return this.userMapper.insertSelective(user);
    }
}
